/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * JDialogResults.java
 *
 * Created on 14/10/2010, 18:44:20
 */
package systole.view.analysis;

import systole.domain.analysis.results.AnalysisResult;

/**
 *
 * @author jmj
 */
public class JDialogResults extends javax.swing.JDialog {

    private AnalysisResult analysisResult;

    /** Creates new form JDialogResults */
    public JDialogResults(java.awt.Frame parent, AnalysisResult analysisResult, JDialogAnalysis jda) {
        super(parent, true);
        initComponents();
        this.analysisResult = analysisResult;
        this.loadResult();
        this.setLocationRelativeTo(jda);
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPnlResults = new javax.swing.JPanel();
        jLblAOS = new javax.swing.JLabel();
        jLblAOD = new javax.swing.JLabel();
        jLblIAR = new javax.swing.JLabel();
        jLblAOSValue = new javax.swing.JLabel();
        jLblAODValue = new javax.swing.JLabel();
        jLblIARValue = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(systole.view.SystoleApp.class).getContext().getResourceMap(JDialogResults.class);
        setTitle(resourceMap.getString("Form.title")); // NOI18N
        setModal(true);
        setName("Form"); // NOI18N
        setResizable(false);

        jPnlResults.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), resourceMap.getString("jPnlResults.border.title"))); // NOI18N
        jPnlResults.setName("jPnlResults"); // NOI18N

        jLblAOS.setText(resourceMap.getString("jLblAOS.text")); // NOI18N
        jLblAOS.setName("jLblAOS"); // NOI18N

        jLblAOD.setText(resourceMap.getString("jLblAOD.text")); // NOI18N
        jLblAOD.setName("jLblAOD"); // NOI18N

        jLblIAR.setText(resourceMap.getString("jLblIAR.text")); // NOI18N
        jLblIAR.setName("jLblIAR"); // NOI18N

        jLblAOSValue.setText(resourceMap.getString("jLblAOSValue.text")); // NOI18N
        jLblAOSValue.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
        jLblAOSValue.setName("jLblAOSValue"); // NOI18N

        jLblAODValue.setText(resourceMap.getString("jLblAODValue.text")); // NOI18N
        jLblAODValue.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
        jLblAODValue.setName("jLblAODValue"); // NOI18N

        jLblIARValue.setText(resourceMap.getString("jLblIARValue.text")); // NOI18N
        jLblIARValue.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
        jLblIARValue.setName("jLblIARValue"); // NOI18N

        javax.swing.GroupLayout jPnlResultsLayout = new javax.swing.GroupLayout(jPnlResults);
        jPnlResults.setLayout(jPnlResultsLayout);
        jPnlResultsLayout.setHorizontalGroup(
            jPnlResultsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPnlResultsLayout.createSequentialGroup()
                .addGap(24, 24, 24)
                .addGroup(jPnlResultsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLblAOS)
                    .addComponent(jLblAOD)
                    .addComponent(jLblIAR))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 101, Short.MAX_VALUE)
                .addGroup(jPnlResultsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLblAOSValue)
                    .addComponent(jLblAODValue)
                    .addComponent(jLblIARValue))
                .addGap(35, 35, 35))
        );
        jPnlResultsLayout.setVerticalGroup(
            jPnlResultsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPnlResultsLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPnlResultsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
                    .addComponent(jLblAOS)
                    .addComponent(jLblAOSValue))
                .addGap(30, 30, 30)
                .addGroup(jPnlResultsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
                    .addComponent(jLblAOD)
                    .addComponent(jLblAODValue))
                .addGap(30, 30, 30)
                .addGroup(jPnlResultsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
                    .addComponent(jLblIAR)
                    .addComponent(jLblIARValue))
                .addContainerGap(18, Short.MAX_VALUE))
        );

        getContentPane().add(jPnlResults, java.awt.BorderLayout.CENTER);

        pack();
    }// </editor-fold>//GEN-END:initComponents
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel jLblAOD;
    private javax.swing.JLabel jLblAODValue;
    private javax.swing.JLabel jLblAOS;
    private javax.swing.JLabel jLblAOSValue;
    private javax.swing.JLabel jLblIAR;
    private javax.swing.JLabel jLblIARValue;
    private javax.swing.JPanel jPnlResults;
    // End of variables declaration//GEN-END:variables

    private void loadResult() {
        this.jLblAODValue.setText(((this.analysisResult.getAod() != null) ? this.analysisResult.getAod().getValueAsString() : ""));
        this.jLblAOSValue.setText(((this.analysisResult.getAos() != null) ? this.analysisResult.getAos().getValueAsString() : ""));
        this.jLblIARValue.setText(((this.analysisResult.getIar() != null) ? this.analysisResult.getIar().getValueAsString() : ""));
    }
}
